package wyn.spec.edu.week12_class01;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class ActivityThirdly extends AppCompatActivity {
    private List<Third> thirdList=new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_third);
        initThird();
        RecyclerView recyclerView=(RecyclerView)findViewById(R.id.recyclerview_view);
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        recyclerView.setLayoutManager(linearLayoutManager);
        ThirdAdapter adapter=new ThirdAdapter(thirdList);
        recyclerView.setAdapter(adapter);
    }
    private void initThird(){
        for (int i=0;i<2;i++){
            Third a=new Third(R.drawable.jn,"济南7.77...");
            thirdList.add(a);
            Third b=new Third(R.drawable.ws,"我是腾腾爸");
            thirdList.add(b);
            Third c=new Third(R.drawable.cy,"川幼应用...");
            thirdList.add(c);
            Third d=new Third(R.drawable.jy,"交易军师");
            thirdList.add(d);
            Third e=new Third(R.drawable.ps,"品师");
            thirdList.add(e);
        }
    }
}
